#pragma once

#pragma pack(push, 1)
struct Message
{
	MessageID m_typeId; // Your type here
	// Your data here
	Message(MessageID typeId):m_typeId(typeId){}
	MessageID GetMessageID()const{return m_typeId;}
};

enum {
	ID_CHAT_REQ = ID_USER_PACKET_ENUM,
	ID_CREATE_CHATROOM_REQ,
	ID_CREATE_CHATROOM_ACK,
	ID_JOIN_CHATROOM_REQ,
	ID_JOIN_CHATROOM_ACK,
	ID_QUERY_CHATROOM_REQ,
	ID_QUERY_CHATROOM_ACK,
	ID_EXIT_CHATROOM_REQ,
	ID_EXIT_CHATROOM_ACK,
};

struct ChatReq : public Message
{
	WORD	m_len;
	BYTE*	m_pChat;
	ChatReq()
		: Message(ID_CHAT_REQ)
		, m_len(0)
		, m_pChat(NULL)
	{

	}
};

struct CreateChatRoomReq : public Message
{
	WORD	m_len;
	BYTE*	m_pName;
	CreateChatRoomReq()
		: Message(ID_CREATE_CHATROOM_REQ)
		, m_len(0)
		, m_pName(NULL)
	{

	}
};

struct CreateChatRoomAck : public Message
{
	bool		m_bSuccess;
	NetworkID	m_chatRoomID;
	WORD		m_len;
	BYTE*		m_pName;
	CreateChatRoomAck()
		: Message(ID_CREATE_CHATROOM_ACK)
		, m_bSuccess(false)
		, m_len(0)
		, m_pName(NULL)
	{

	}
};

struct JoinChatRoomReq : public Message
{
	NetworkID	m_chatRoomID;
	JoinChatRoomReq()
		: Message(ID_JOIN_CHATROOM_REQ)
	{

	}
};

struct JoinChatRoomAck : public Message
{
	bool m_bSuccess;
	BYTE m_userCount;
	RakNetGUID* pRakNetGuids;
	JoinChatRoomAck()
		: Message(ID_JOIN_CHATROOM_ACK)
		, m_bSuccess(false)
		, m_userCount(0)
		, pRakNetGuids(NULL)
	{

	}
};

struct QueryChatRoomReq : public Message
{
	QueryChatRoomReq()
		: Message(ID_QUERY_CHATROOM_REQ)
	{

	}
};

struct QueryChatRoomAck : public Message
{
	BYTE m_roomCount;

	struct _chatRoom
	{
		NetworkID m_roomID;
		WORD	m_len;
		BYTE*	m_pName;
	};

	_chatRoom*	m_pChatRoom;
	
	QueryChatRoomAck()
		: Message(ID_QUERY_CHATROOM_ACK)
		, m_roomCount(0)
		, m_pChatRoom(NULL)
	{

	}
};

struct ExitChatRoomReq : public Message
{
	ExitChatRoomReq()
		: Message(ID_EXIT_CHATROOM_REQ)
	{

	}
};

#pragma pack(pop)